package com.zlfund.cat.zjgsmk.adapter;

import android.content.Context;

/**
 * Created by chenjun on 2017/8/19.
 */

public class AdapterFactory {

    private static AdapterFactory mFactory;

    private AdapterFactory(){

    }

    public static AdapterFactory singleTon(){
        if (mFactory == null){
            synchronized (AdapterFactory.class){
                if (mFactory == null){
                    mFactory = new AdapterFactory();
                }
            }
        }
        return mFactory;
    }

    public <T> ListViewAdapter<T> createOneTypeLvAdapter(Context context, ListViewOneTypeAdapterHelper<T> helper){
        return new ListViewAdapter<>(context, helper);
    }

    public <T> ListViewAdapter<T> createMulTypeLvAdapter(Context context, ListViewMulTypeAdapterHelper<T> helper){
        return new ListViewAdapter<>(context,helper);
    }

    public <T extends BaseBean> RecyclerViewAdapter<T> createOneTypeRvAdapter(Context context,RecyclerViewOneTypeAdapterHelper<T> helper){
        return new RecyclerViewAdapter<>(context,helper);
    }

    public <T extends BaseBean> RecyclerViewAdapter<T> createMulTypeRvAdapter(Context context,RecyclerViewMulTypeAdapterHelper<T> helper){
        return new RecyclerViewAdapter<>(context,helper);
    }
}
